package com.renjiyue.dao;

import com.renjiyue.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    //查询全部用户
    List<User> selectUser();
    //根据id查询用户
    User selectUserById(int id);
    //通过密码和姓名查询用户
    User selectUserByNP(@Param("name")String username,@Param("pwd")String possword);
    User selectUserByNP2(Map<String,Object> map);
    //添加一个用户
    int addUser(User user);
    //修改一个用户
    int updateUser(User user);
    //删除一个用户
    int deleteUser(int id);
    //查询全部用户
    @Select("select id,username,possword from user")
    List<User> getAllUser();
    @Select("select * from user where id = #{id}")
    User selectUserById1(@Param("id") int id);
    //添加一个用户
    @Insert("insert into user(id,username,possword) value (#{id},#{username},#{possword})")
    int addUser2(User user);
    //根据id删除
    @Delete("delete from user where id = #{id}")
    int deleteUser3(@Param("id") int id);
}
